package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AgentRelationshipMapper;
import com.ruoyi.system.domain.AgentRelationship;
import com.ruoyi.system.service.IAgentRelationshipService;
import com.ruoyi.common.core.text.Convert;

/**
 * 中介联系记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-14
 */
@Service
public class AgentRelationshipServiceImpl implements IAgentRelationshipService 
{
    @Autowired
    private AgentRelationshipMapper agentRelationshipMapper;

    /**
     * 查询中介联系记录
     * 
     * @param id 中介联系记录ID
     * @return 中介联系记录
     */
    @Override
    public AgentRelationship selectAgentRelationshipById(Long id)
    {
        return agentRelationshipMapper.selectAgentRelationshipById(id);
    }

    /**
     * 查询中介联系记录列表
     * 
     * @param agentRelationship 中介联系记录
     * @return 中介联系记录
     */
    @Override
    public List<AgentRelationship> selectAgentRelationshipList(AgentRelationship agentRelationship)
    {
        return agentRelationshipMapper.selectAgentRelationshipList(agentRelationship);
    }

    /**
     * 新增中介联系记录
     * 
     * @param agentRelationship 中介联系记录
     * @return 结果
     */
    @Override
    public int insertAgentRelationship(AgentRelationship agentRelationship)
    {
        agentRelationship.setCreateTime(DateUtils.getNowDate());
        return agentRelationshipMapper.insertAgentRelationship(agentRelationship);
    }

    /**
     * 修改中介联系记录
     * 
     * @param agentRelationship 中介联系记录
     * @return 结果
     */
    @Override
    public int updateAgentRelationship(AgentRelationship agentRelationship)
    {
        agentRelationship.setUpdateTime(DateUtils.getNowDate());
        return agentRelationshipMapper.updateAgentRelationship(agentRelationship);
    }

    /**
     * 删除中介联系记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAgentRelationshipByIds(String ids)
    {
        return agentRelationshipMapper.deleteAgentRelationshipByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除中介联系记录信息
     * 
     * @param id 中介联系记录ID
     * @return 结果
     */
    @Override
    public int deleteAgentRelationshipById(Long id)
    {
        return agentRelationshipMapper.deleteAgentRelationshipById(id);
    }
}
